<?php

require("../config.php");

if (!isset($_GET['id'])) {
	$query = mysql_query("SELECT id, nume FROM planete WHERE user = '".$user."'");
	echo 'Planeta: <select name="planete" onchange="javascript:schimba_planeta(this.options[this.selectedIndex].value)">';
	 while ($rez = mysql_fetch_array($query)) {
	 if ($rez['id'] == $planeta)
	  echo '<option value="'.$rez['id'].'" selected="selected">'.$rez['nume'].'</option>';
	 else
	  echo '<option value="'.$rez['id'].'" >'.$rez['nume'].'</option>';
     }	 
	echo '</select>';
} else {
	$id = addentities($_GET['id']);
    $verificare = valoare_mysql("SELECT id FROM planete WHERE id = '".$id."'");
	if ($verificare != 0) {
	   $nume = valoare_mysql("SELECT nume FROM planete WHERE id = '".$id."'");
	   $_SESSION['planeta'] = $id;
	   echo 'Planeta <strong>'.$nume.'</strong> a fost selectata.';
	   } else
	   echo 'Planeta nu s-a putut selecta.';
}

?>